fix(server): fail start() when the pool's bootloader kills every worker - #143
Merged
Conversation
A bootloader that throws closes the pool before any worker reaches its request loop, so every submission is rejected and the server binds nothing. The parent discarded the rejection's exception and read pending == 0 as success: start() answered true for a run in which no connection was ever accepted, and the process exited 0 with no trace of the cause. pool_worker_done_cb now counts the rejected workers and prints the first reason; start() answers false when that count is non-zero. The exception text comes from the worker itself and needs the matching true_async build.
The fatal comes from the extension, so asserting it here made the test fail on any build older than the pool fix. php-async pins that half already; this test keeps what the server itself owns: the reason on stderr and start() == false.
Contributor
CoverageTotal lines: 81.86% → 81.90% (+0.04 pp)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reported by a user: a
setBootloader()closure that throws produces no message anywhere — not on stdout, not on stderr, not inerror_log— and the process exits 0.Two causes, one in each repository.
The pool closes as soon as a bootloader throws, so every worker's submission is rejected before
pool_worker_handlerruns.pool_worker_done_cbdiscarded the rejection's exception ((void)exception) andrcwas computed frompending == 0alone, sostart()answeredtruefor a run in which nothing was ever bound and no connection was ever accepted. The callback now counts the rejected workers and prints the first reason:and
start()answersfalsewhen that count is non-zero. A healthy run is unaffected: workers that serve and then stop complete without an exception, so the count stays zero andstart()still answerstrue.The exception text is the pool's half of the fix — true-async/php-async#225 — and reaches the user through the worker's own error stream (
display_errors,error_log). This PR does not depend on it:022-bootloader-failure.phptasserts only what the parent owns, so it passes on either build, and #225 pins the report in its own repository.Tests
022-bootloader-failure.phptis new.tests/phpt/server/corelocally: 78 tests, 8 failures, of which 7 fail identically onmainwithout this change (verified by rebuilding the module without it and running the same eight); the eighth is018-log-off-no-overhead, a timing test that fails only under the ten-worker parallel run and passes on its own.